//
//  PassAuditViewController.swift
//  ParkManage
//
//  Created by Jalon on 9/28/20.
//  Copyright © 2020 diligrp. All rights reserved.
//

import UIKit

enum AuditType: String {
    case pass, departure
}

class PassAuditViewController: BaseViewController {

    @IBOutlet weak var collectionView: UICollectionView!
    var type: AuditType!
    
    override func viewDidLoad() {
        super.viewDidLoad()

        title = type == AuditType.pass ?  "通行证审核" : "转离场审核"
        
        let layout = UICollectionViewFlowLayout()
        layout.itemSize = CGSize(width: Configs.Dimensions.screenWidth - 30, height: 115)
        layout.sectionInset = UIEdgeInsets(top: 13, left: 15, bottom: 13, right: 15)
        layout.minimumLineSpacing = 15
        
        collectionView.backgroundColor = .themeBackGround()
        collectionView.collectionViewLayout = layout
        collectionView.register(R.nib.passAuditCell)
    }
}

extension PassAuditViewController: UICollectionViewDataSource {
    func collectionView(_ collectionView: UICollectionView, numberOfItemsInSection section: Int) -> Int {
        10
    }
    
    func collectionView(_ collectionView: UICollectionView, cellForItemAt indexPath: IndexPath) -> UICollectionViewCell {
        let cell: PassAuditCell = collectionView.dequeueReusableCell(
            withReuseIdentifier: R.reuseIdentifier.passAuditCell, for: indexPath
        )!
        return cell
    }
}

extension PassAuditViewController: UICollectionViewDelegate {
    func collectionView(_ collectionView: UICollectionView, didSelectItemAt indexPath: IndexPath) {
        navigator.push(PassAuditURL.passAuditDetail.path)
    }
}
